package com.hua.jdk8;

/**
 * @author: _hua
 * @created: 2019/3/29.
 * @updater:
 * @description:
 */
interface MyInterface<P,R>{
    public R function(P p);//和String.valueOf(int x)类似
}
interface MyInterface1{
    String function(Integer a);
}
public class Main {
    public static void test(MyInterface1 myInterface1){
        String result = myInterface1.function(2000);
        System.out.println(result+"  --");
    }
    public static void main(String[] args) {
        test(new MyInterface1() {
            @Override
            public String function(Integer a) {
                return String.valueOf(a);
            }
        });

        //Lamda表达式实现
        test((a)->String.valueOf(a));

        //方法引用实现:引用类的静态方法
        MyInterface<Integer,String> msg = String::valueOf;
        String str = msg.function(2000);
        System.out.println(str);
    }
}
